//package br.pucrio.inf.les.SPLAnalyser.impl.squidplugin.query;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import br.ufrn.dimap.ase.squid.core.facade.Query;
//import br.ufrn.dimap.ase.squid.core.models.squidmodel.Asset;
//import br.ufrn.dimap.ase.squid.core.models.squidmodel.Feature;
//import br.ufrn.dimap.ase.squid.core.models.squidmodel.SquidModel;
//import br.ufrn.dimap.ase.squid.core.models.squidmodel.Mapping;
//import br.pucrio.inf.les.SPLAnalyser.core.models.impactvisualizermodel.ImpactVisualizerModel;
//import br.pucrio.inf.les.SPLAnalyser.core.models.impactvisualizermodel.ResultSet;
//import br.ufrn.dimap.ase.squid.core.models.util.SquidModelContent;
//import br.ufrn.dimap.ase.squid.core.models.util.ImpactVisualizerModelHandler;
//import br.pucrio.inf.les.SPLAnalyser.impl.query.models.RemoveFeatureQueryModel;
//
//
//public class ImpactOfRemoveFeature implements Query {
//	private SquidModelContent analysisModelContent;		
//	private String featureName;
//		
//	public ImpactOfRemoveFeature(String featureName){
//		this.featureName = featureName;
//	}
//	
//	public RemoveFeatureQueryModel runQuery(SquidModel analysisModel) {
//		analysisModelContent = new SquidModelContent(analysisModel);
//		Feature feature = analysisModelContent.findFeature(featureName);
//		
//		List<Asset> exclusiveAssets = new ArrayList<Asset>();
//		List<Asset> dependentAssets = new ArrayList<Asset>();
//		List<Asset> sharedAssets = new ArrayList<Asset>();
//		List<Feature> affectedFeatures = new ArrayList<Feature>();
//		
//		List<Mapping> mappings = analysisModelContent.findMappingOf(feature);
//		for(Mapping map : mappings){
//			if(map.getFeatures().size() == 1){
//				exclusiveAssets.add(map.getAssets());
//			}else if (map.getFeatures().size() > 1){
//				sharedAssets.add(map.getAssets());
//				affectedFeatures.addAll(map.getFeatures());
//			}
//		}
//		
//		for(Asset asset : exclusiveAssets){
//			dependentAssets.addAll( analysisModelContent.getAssetsDependenciasOf(asset));
//		}
//		
//		for(Asset asset : dependentAssets){
//			Mapping map = analysisModelContent.findMappingOf(asset);
//			affectedFeatures.addAll(map.getFeatures());			
//		}
//		RemoveFeatureQueryModel result = new RemoveFeatureQueryModel(exclusiveAssets, 
//				dependentAssets, sharedAssets, affectedFeatures);
//		
//		
//		return result;	
//	}
//
//	public String getName() {
//		return this.getClass().getSimpleName() + "_" + featureName;
//	}
//	
//	private ImpactVisualizerModel createQueryModel(List<Asset> exclusiveAssets, List<Asset> dependentAssets, List<Asset> sharedAssets, List<Feature> affectedFeatures ){
//		ImpactVisualizerModelHandler queryModelContent = new ImpactVisualizerModelHandler(getName());
//		
//		ResultSet exclusiveAssetsSet = queryModelContent.addResultSet("Exclusive Assets");
//		queryModelContent.addAssetResult(exclusiveAssetsSet, exclusiveAssets);
//		
//		ResultSet dependentAssetsSet = queryModelContent.addResultSet("Dependent Assets");
//		queryModelContent.addAssetResult(dependentAssetsSet, dependentAssets);
//		
//		ResultSet sharedAssetsSet = queryModelContent.addResultSet("Shared Assets");
//		queryModelContent.addAssetResult(sharedAssetsSet, sharedAssets);
//		
//		ResultSet affectedFeaturesSet = queryModelContent.addResultSet("Affected Features");
//		queryModelContent.addFeatureResult(affectedFeaturesSet, affectedFeatures);
//		
//		return queryModelContent.getImpactVisualizerModel()	;
//		
//	}
//}
